package main

import (
	"fmt"
	"log"
	"strings"
	"time"

	"gitee.com/dark.H/DataDash/in"
)

func main() {
	// in.Test()
	// in.TestWindows()
	// in.TestMongo()
	println("------- sqlite3 ")
	bottle, err := in.NewSqlBottle("sqlite3:///Users/dr/Desktop/cache.db")
	if err != nil {
		log.Fatal(err)
	}
	for no, v := range bottle.Query(in.OperWith("Host").Set(in.G{
		"len":  20,
		"page": 2,
	})) {
		println("--- no:", no)
		in.ColorD(v)
	}

	fmt.Println(strings.Join(bottle.Desc("Host"), " | "))

	in.ColorL("mysql", "test")
	bottle, err = in.NewSqlBottle("mysql://root:hello@tcp(192.168.188.102)/wjs?charset=utf8")
	if err != nil {
		log.Fatal(err)
	}

	in.ColorS(bottle.Desc("log")...)
	st := time.Now()
	for no, _ := range bottle.Query(in.OperWith("log").Set(in.G{"len": 100000})) {

		// in.ColorD(v)
		fmt.Print("no : ", no, "\r")
	}
	fmt.Println("used time :", time.Now().Sub(st))

}
